<script setup lang="ts">
import CustomNavbar from './components/CustomNavbar.vue'
import { ref } from 'vue'
import { getHomeBannerApi } from '@/services/home'
import type { BannerItem } from '@/types/home'
import { onLoad } from '@dcloudio/uni-app'
import CategoryPanel from './components/CategoryPanel.vue'

const bannerList = ref<BannerItem[]>([])
const getHomeBannerData = async () => {
  const res = await getHomeBannerApi()
  console.log(res)
  bannerList.value = res.result
}

onLoad(() => {
  getHomeBannerData()
})
</script>

<template>
  <view class="index">
    <CustomNavbar></CustomNavbar>
    <XtxSwiper :list="bannerList"></XtxSwiper>
    <CategoryPanel></CategoryPanel>
  </view>
</template>

<style lang="scss">
page {
  background-color: #f7f7f7;
}
</style>
